function load_application() {
    time_picker_behaviour();
    onclick_password_behaviour();
    calendar_edit_client_behaviour();
    erra_popup_behaviour();
    bloc_behaviour();
    select_template_behaviour();
    extra_field_edit_behaviour();
    stats_behaviour();
    // Enable specific functions
    event_action_remote();
    if ($('#sync-reload-action').length) {
        click($('#sync-reload-action'), function() {
            executeLocalStack();
        });
    }
    enable_campaign();

    // FOR DEMO BEHAVIOURS
    if ($('.demo-banner').length) {
        var leftStart = $('#container').position().left - 152;
        $('.demo-banner').css('left', leftStart);
        $(window).resize(function() {
            var leftStart = $('#container').position().left - 152;
            $('.demo-banner').css('left', leftStart);
        });
    }
    // TODO : move this
    // Autocomplete for calendar
    if ($('#calendar_edit_client').length) {
        _load_autocomplete($('#calendar_edit_client'), c_);
    }
    $('.calendar-view-type').click(function() {
        if (!$(this).hasClass('.view-type-selected')) {
            if ($(this).hasClass('calendar-view-type-web')) {
                window.calendarCache['displayType'] = 'web';
                $('.calendar-view-type').removeClass('view-type-selected');
                $(this).addClass('view-type-selected');
                $('#calendar').weekCalendar('refresh');
            } else {
                window.calendarCache['displayType'] = 'std';
                $('.calendar-view-type').removeClass('view-type-selected');
                $(this).addClass('view-type-selected');
                $('#calendar').weekCalendar('refresh');
            }
        }
    });

}



function displayError(msg) {
    $('.ajax-config-error span').html(msg);
    $('.ajax-config-error').show().delay(3000).fadeOut(500);
}



function updater() {
    $('.erra-update').click(function() {
        var update_target = $('#update_target').val();
        $('#update_infos').html('Mise à jour en cours');
        ajax(WEBROOT + '/getdata/update_to', {
            'update_target': update_target
        }, function(data) {
            $('#update_infos').html('');
            alert_jqueryui_ok(getRest(data)['message'], function() {
                location.reload();
            });
        });
    });
}


function ajaxPrestationColorChange(){
    var new_champs = {
        update:{slot_color:$(this).val()},
        object:'msa_prestationobject',
        id:$(this).attr('id'),
        query:'update_object'
    };
    ajax(WEBROOT + '/webservice', new_champs, function(data) {
        var result = jQuery.parseJSON($.trim(data));
        if(result.result == 'Success'){
            erraSuccess("Modification enregistrée");
        }else{
            erraError('Modification échouée');
        }
    });
    
}